package cn.swust.designpatternlearningplatform.service;

import cn.swust.designpatternlearningplatform.common.Result.PageInfo;
import cn.swust.designpatternlearningplatform.domain.bo.TopicBo;
import cn.swust.designpatternlearningplatform.domain.bo.TopicKpointBo;
import cn.swust.designpatternlearningplatform.domain.bo.TopicOptionsBo;
import cn.swust.designpatternlearningplatform.domain.dto.TopicDto;
import cn.swust.designpatternlearningplatform.domain.entity.TopicOption;
import cn.swust.designpatternlearningplatform.domain.vo.TopicVo;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Set;

public interface TopicService {
    /**
     * 根据题目id查询题目
     *
     * @param topicId
     * @return cn.swust.designpatternlearningplatform.domain.entity.Topic
     * @author Tang
     * @date 2023/5/13 20:58
     **/
    TopicDto selectTopicById(Integer topicId);

    /**
     * 获取与知识点相关联的题目
     *
     * @param pointId
     * @return java.util.List<cn.swust.designpatternlearningplatform.domain.dto.TopicDto>
     * @author Tang
     * @date 2023/7/24 10:48
     **/
    List<TopicDto> selectTopicByPointId(Integer pointId);

    /**
     * 获取题目的选项
     *
     * @param topicBo
     * @return java.util.List<cn.swust.designpatternlearningplatform.domain.entity.TopicOption>
     * @author Tang
     * @date 2023/5/13 20:56
     **/
    List<TopicOption> getOptionsOfTopic(TopicBo topicBo);

    /**
     * 添加题目（基本信息，题目选项信息，知识点信息）
     *
     * @param topicBo
     * @param topicKpointBo
     * @param topicOptionsBo
     * @return void
     * @author Tang
     * @date 2023/5/13 20:56
     **/
    @Transactional(rollbackFor = Exception.class)
    void addTopic(TopicBo topicBo, TopicKpointBo topicKpointBo, TopicOptionsBo topicOptionsBo);

    /**
     * 通过excel读取题目
     *
     * @param file
     * @return void
     * @author Tang
     * @date 2023/5/25 12:27
     **/
    List<TopicVo> readTopicByExcel(MultipartFile file) throws IOException;

    /**
     * 通过excel批量添加题目
     *
     * @param file
     * @return void
     * @author Tang
     * @date 2023/5/25 12:27
     **/
    void addTopicByExcel(MultipartFile file);

    /**
     * 更新题目难度系数
     *
     * @param topicBo
     * @return void
     * @author Tang
     * @date 2023/5/13 20:57
     **/
    void updateTopicIndicatorsDifficulty(TopicBo topicBo);


    /**
     * 分页按知识点查询题目
     *
     * @param pageInfo
     * @return cn.swust.designpatternlearningplatform.common.Result.PageInfo<cn.swust.designpatternlearningplatform.domain.dto.TopicDto>
     * @author Tang
     * @date 2023/5/19 20:39
     **/
    PageInfo<TopicDto> selectByPage(PageInfo<TopicDto> pageInfo, Integer pointId, String[] ignore);

    /**
     * 更新题目
     *
     * @param topicBo
     * @param topicKpointBo
     * @param topicOptionsBo
     * @return void
     * @author Tang
     * @date 2023/7/22 10:34
     **/
    @Transactional(rollbackFor = Exception.class)
    void updateTopic(TopicBo topicBo, TopicKpointBo topicKpointBo, TopicOptionsBo topicOptionsBo);

    /**
     * 批量删除
     *
     * @param topicIds
     * @return void
     * @author Tang
     * @date 2023/7/22 11:36
     **/
    @Transactional(rollbackFor = Exception.class)
    void batchDelete(List<Integer> topicIds);


    /**
     * 根据题目id批量查询题目信息
     *
     * @param topicIds
     * @return java.util.List<cn.swust.designpatternlearningplatform.domain.dto.TopicDto>
     * @author Tang
     * @date 2023/10/3 16:10
     **/
    List<TopicDto> getTopicByTopicIds(List<Integer> topicIds);

    /**
     * 根据学号查询做过的题目
     *
     * @param studentNumber
     * @return
     */
    PageInfo<TopicDto> getTopicByStudentNumber(String studentNumber, Integer pointId, Integer currentPage, Integer size);
}
